- 
                Notifications
    You must be signed in to change notification settings 
- Fork 372
Add bytes() method to Body mixin #1753
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
          
     Merged
      
      
    
                
     Merged
            
            
          Conversation
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
    
  This was referenced May 10, 2024 
      
              
                    annevk
  
              
              approved these changes
              
                  
                    May 13, 2024 
                  
              
              
            
            
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With implementation bugs and an MDN issue I think this is good to go. Thanks for working on it!
  This was referenced May 13, 2024 
      
| OK, opened the implementation bugs and MDN issue. | 
    
  annevk 
      pushed a commit
        to web-platform-tests/wpt
      that referenced
      this pull request
    
      May 14, 2024 
    
    
  
  This was referenced May 21, 2024 
      
    
  webkit-commit-queue 
      pushed a commit
        to annevk/WebKit
      that referenced
      this pull request
    
      May 21, 2024 
    
    
      
  
    
      
    
  
https://bugs.webkit.org/show_bug.cgi?id=274102 Reviewed by Youenn Fablet. This accessor is nearly identical to arrayBuffer() except that it yields a Uint8Array, which is strictly more useful. Fetch change: whatwg/fetch#1753. * LayoutTests/imported/w3c/web-platform-tests/fetch/api/abort/general.any-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/fetch/api/abort/general.any.serviceworker-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/fetch/api/abort/general.any.sharedworker-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/fetch/api/abort/general.any.worker-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/fetch/api/abort/serviceworker-intercepted.https-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-consume.any-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-consume.any.serviceworker-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-consume.any.sharedworker-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-consume.any.worker-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-blob-realm.any-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-error-from-stream.any-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-error-from-stream.any.serviceworker-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-error-from-stream.any.sharedworker-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-error-from-stream.any.worker-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-stream-bad-chunk.any-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-stream-bad-chunk.any.serviceworker-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-stream-bad-chunk.any.sharedworker-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-stream-bad-chunk.any.worker-expected.txt: * Source/WebCore/Modules/fetch/FetchBody.cpp: (WebCore::FetchBody::bytes): * Source/WebCore/Modules/fetch/FetchBody.h: * Source/WebCore/Modules/fetch/FetchBody.idl: * Source/WebCore/Modules/fetch/FetchBodyConsumer.cpp: (WebCore::resolveWithTypeAndData): (WebCore::FetchBodyConsumer::resolve): * Source/WebCore/Modules/fetch/FetchBodyConsumer.h: * Source/WebCore/Modules/fetch/FetchBodyOwner.cpp: (WebCore::FetchBodyOwner::bytes): * Source/WebCore/Modules/fetch/FetchBodyOwner.h: * Source/WebCore/bindings/js/JSDOMPromiseDeferred.cpp: (WebCore::fulfillPromiseWithUint8Array): (WebCore::fulfillPromiseWithUint8ArrayFromSpan): * Source/WebCore/bindings/js/JSDOMPromiseDeferred.h: Canonical link: https://commits.webkit.org/279036@main
    
  moz-v2v-gh 
      pushed a commit
        to mozilla/gecko-dev
      that referenced
      this pull request
    
      May 21, 2024 
    
    
      
  
    
      
    
  
…in, a=testonly Automatic update from web-platform-tests Fetch: bytes() method on Body mixin For whatwg/fetch#1753. -- wpt-commits: 1b9332c3c8a84d34e38271d29518c204ab2cfb6e wpt-pr: 46198
    
  jamienicol 
      pushed a commit
        to jamienicol/gecko
      that referenced
      this pull request
    
      May 23, 2024 
    
    
      
  
    
      
    
  
…in, a=testonly Automatic update from web-platform-tests Fetch: bytes() method on Body mixin For whatwg/fetch#1753. -- wpt-commits: 1b9332c3c8a84d34e38271d29518c204ab2cfb6e wpt-pr: 46198
    
  jwidar 
      pushed a commit
        to jwidar/LatencyZeroGithub
      that referenced
      this pull request
    
      Sep 16, 2025 
    
    
      
  
    
      
    
  
…in, a=testonly Automatic update from web-platform-tests Fetch: bytes() method on Body mixin For whatwg/fetch#1753. -- wpt-commits: 1b9332c3c8a84d34e38271d29518c204ab2cfb6e wpt-pr: 46198
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
      
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Adds a
bytes()method to get aUint8ArraytoBody, instead of requiring users to get anArrayBufferand then wrap it.Fixes #1732.
.bytes()method denoland/deno#23790.bytes()method nodejs/undici#3256.bytes()method oven-sh/bun#11049.bytes()methods mdn/mdn#545(See WHATWG Working Mode: Changes for more details.)
Preview | Diff